﻿using DataModels.Dto;
using DataModels.Entities.Visitor;
using Microsoft.AspNetCore.Mvc;
using Services.Visitor;
using Services.WorkOrder;
using SqlSugar;

namespace PropertyManagementWebApi.Controllers.Visitor
{
    public class VisitorController(VisitorService visitorService) : BaseController
    {
        protected readonly VisitorService _visitorService = visitorService;

        /// <summary>
        /// 获取访问人员
        /// </summary>
        /// <param name="HousingBasicUUID"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel GetVisitorByHousingBasicUUID(string HousingBasicUUID)
        {
            return _visitorService.GetVisitorByHousingBasicUUID(HousingBasicUUID);

        }
        /// <summary>
        /// 添加访问人员
        /// </summary>
        /// <param name="visitRecord"></param>
        /// <returns></returns>
        [HttpPost]
        public ResponseModel AddVisitor(Visiter visitRecord)
        {
            return _visitorService.AddVisitor(visitRecord);
        }
        /// <summary>
        /// 修改访问状态
        /// </summary>
        /// <param name="UUID"></param>
        /// <param name="IsVisit"></param>
        /// <returns></returns>
        [HttpGet]
        public ResponseModel EidtVisitor(string UUID, int IsVisit)
        {
            return _visitorService.EidtVisitor(UUID, IsVisit);
        }
    }
}
